/**
 * 分类模块路由文件
 */

const Router = require('koa-router');
const router = new Router();
const { validate } = require('../validators/common');
const { add, update, deleteClass, getAll } = require('../services/classify');
const { validAdd, validUpdate } = require('../validators/classify');
const { authorization } = require('./common');

router.prefix('/classify');

router.post('/add', authorization('classifyAdd'), validate(validAdd), add);

router.put('/update', authorization('classifyUpdate'), validate(validUpdate), update);

router.get('/all', authorization('classifyGet', 'classifyAdd', 'goodsSearch', 'goodsAdd'), getAll);

router.delete('/delete/:id', authorization('classifyDelete'), deleteClass);

module.exports = router;